package view;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JTextField;
import util.Comandos;
import controller.FrecuenciaController;
import java.awt.Font;
import javax.swing.JButton;


public class FrecuenciaFrame extends JDialog {

	private static final long serialVersionUID = 1L;
	
	private JTextField edadText;
	private JLabel frecMax;
	
	private JLabel baseCarrera1;
	private JLabel baseCarrera2;
	private JLabel n1carrera1;
	private JLabel n1carrera2;
	private JLabel n2carrera1;
	private JLabel n2carrera2;
	private JLabel n3carrera1;
	private JLabel n3carrera2;
	private JLabel n4carrera1;
	private JLabel n4carrera2;
	
	private JLabel baseCiclismo1;
	private JLabel baseCiclismo2;
	private JLabel n1ciclismo1;
	private JLabel n1ciclismo2;
	private JLabel n2ciclismo1;
	private JLabel n2ciclismo2;
	private JLabel n3ciclismo1;
	private JLabel n3ciclismo2;
	private JLabel n4ciclismo1;
	private JLabel n4ciclismo2;
	
	private JLabel jLabel0;
	private JLabel jLabel1;
	
	private JLabel jLabel3;
	private JLabel jLabel6;
	private JLabel jLabel8;
	private JLabel jLabel9;
	private JLabel jLabel10;
	private JLabel jLabel13;
	private JLabel jLabel15;
	private JButton btnCap;
	
	
	public FrecuenciaFrame(PrincipalFrame principal) {
		setResizable(false);
		initComponents();
	}

	private void initComponents() {
		setTitle("Frecuencia");
		getContentPane().setLayout(null);
		getContentPane().add(getJLabel0());
		getContentPane().add(getJLabel1());
		getContentPane().add(getJLabel3());
		getContentPane().add(getJLabel2());
		getContentPane().add(getJTextField0());
		getContentPane().add(getJLabel6());
		getContentPane().add(getJLabel8());
		getContentPane().add(getJLabel9());
		getContentPane().add(getJLabel10());
		getContentPane().add(getJLabel25());
		getContentPane().add(getJLabel11());
		getContentPane().add(getJLabel16());
		getContentPane().add(getJLabel17());
		getContentPane().add(getJLabel18());
		getContentPane().add(getJLabel19());
		getContentPane().add(getJLabel20());
		getContentPane().add(getJLabel26());
		getContentPane().add(getJLabel28());
		getContentPane().add(getJLabel27());
		getContentPane().add(getJLabel30());
		getContentPane().add(getJLabel29());
		getContentPane().add(getJLabel13());
		getContentPane().add(getJLabel21());
		getContentPane().add(getJLabel22());
		getContentPane().add(getJLabel15());
		getContentPane().add(getJLabel23());
		getContentPane().add(getJLabel24());
		getContentPane().add(getJLabel34());
		getContentPane().add(getJLabel33());
		getContentPane().add(getJLabel32());
		getContentPane().add(getJLabel31());
		getContentPane().add(getBtnCap());
		setSize(616, 840);
	}

	private JLabel getJLabel34() {
		if (n4ciclismo2 == null) {
			n4ciclismo2 = new JLabel();
			n4ciclismo2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n4ciclismo2.setBounds(443, 716, 90, 23);
		}
		return n4ciclismo2;
	}

	private JLabel getJLabel33() {
		if (n4ciclismo1 == null) {
			n4ciclismo1 = new JLabel();
			n4ciclismo1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n4ciclismo1.setBounds(443, 667, 90, 23);
		}
		return n4ciclismo1;
	}

	private JLabel getJLabel32() {
		if (n3ciclismo2 == null) {
			n3ciclismo2 = new JLabel();
			n3ciclismo2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n3ciclismo2.setBounds(443, 604, 90, 23);
		}
		return n3ciclismo2;
	}

	private JLabel getJLabel31() {
		if (n3ciclismo1 == null) {
			n3ciclismo1 = new JLabel();
			n3ciclismo1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n3ciclismo1.setBounds(443, 555, 90, 23);
		}
		return n3ciclismo1;
	}

	private JLabel getJLabel30() {
		if (n2ciclismo2 == null) {
			n2ciclismo2 = new JLabel();
			n2ciclismo2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n2ciclismo2.setBounds(443, 494, 90, 23);
		}
		return n2ciclismo2;
	}

	private JLabel getJLabel29() {
		if (n2ciclismo1 == null) {
			n2ciclismo1 = new JLabel();
			n2ciclismo1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n2ciclismo1.setBounds(443, 444, 90, 23);
		}
		return n2ciclismo1;
	}

	private JLabel getJLabel28() {
		if (n1ciclismo2 == null) {
			n1ciclismo2 = new JLabel();
			n1ciclismo2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n1ciclismo2.setBounds(443, 376, 90, 23);
		}
		return n1ciclismo2;
	}

	private JLabel getJLabel27() {
		if (n1ciclismo1 == null) {
			n1ciclismo1 = new JLabel();
			n1ciclismo1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n1ciclismo1.setBounds(443, 326, 90, 23);
		}
		return n1ciclismo1;
	}

	private JLabel getJLabel26() {
		if (baseCiclismo2 == null) {
			baseCiclismo2 = new JLabel();
			baseCiclismo2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			baseCiclismo2.setBounds(443, 259, 90, 23);
		}
		return baseCiclismo2;
	}

	private JLabel getJLabel25() {
		if (baseCiclismo1 == null) {
			baseCiclismo1 = new JLabel();
			baseCiclismo1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			baseCiclismo1.setBounds(443, 214, 90, 23);
		}
		return baseCiclismo1;
	}

	private JLabel getJLabel24() {
		if (n4carrera2 == null) {
			n4carrera2 = new JLabel();
			n4carrera2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n4carrera2.setBounds(277, 716, 90, 23);
		}
		return n4carrera2;
	}

	private JLabel getJLabel23() {
		if (n4carrera1 == null) {
			n4carrera1 = new JLabel();
			n4carrera1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n4carrera1.setBounds(277, 667, 90, 23);
		}
		return n4carrera1;
	}

	private JLabel getJLabel22() {
		if (n3carrera2 == null) {
			n3carrera2 = new JLabel();
			n3carrera2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n3carrera2.setBounds(277, 604, 90, 23);
		}
		return n3carrera2;
	}

	private JLabel getJLabel21() {
		if (n3carrera1 == null) {
			n3carrera1 = new JLabel();
			n3carrera1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n3carrera1.setBounds(277, 555, 90, 23);
		}
		return n3carrera1;
	}

	private JLabel getJLabel20() {
		if (n2carrera2 == null) {
			n2carrera2 = new JLabel();
			n2carrera2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n2carrera2.setBounds(277, 494, 90, 23);
		}
		return n2carrera2;
	}

	private JLabel getJLabel19() {
		if (n2carrera1 == null) {
			n2carrera1 = new JLabel();
			n2carrera1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n2carrera1.setBounds(277, 444, 90, 23);
		}
		return n2carrera1;
	}

	private JLabel getJLabel18() {
		if (n1carrera2 == null) {
			n1carrera2 = new JLabel();
			n1carrera2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n1carrera2.setBounds(277, 376, 90, 23);
		}
		return n1carrera2;
	}

	private JLabel getJLabel17() {
		if (n1carrera1 == null) {
			n1carrera1 = new JLabel();
			n1carrera1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			n1carrera1.setBounds(277, 326, 90, 23);
		}
		return n1carrera1;
	}

	private JLabel getJLabel16() {
		if (baseCarrera2 == null) {
			baseCarrera2 = new JLabel();
			baseCarrera2.setFont(new Font("Tahoma", Font.PLAIN, 21));
			baseCarrera2.setBounds(277, 259, 90, 23);
		}
		return baseCarrera2;
	}

	private JLabel getJLabel15() {
		if (jLabel15 == null) {
			jLabel15 = new JLabel();
			jLabel15.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel15.setBounds(40, 667, 227, 23);
			jLabel15.setText("N4 Glucolitico");
		}
		return jLabel15;
	}

	private JLabel getJLabel13() {
		if (jLabel13 == null) {
			jLabel13 = new JLabel();
			jLabel13.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel13.setBounds(40, 555, 227, 23);
			jLabel13.setText("N3 VO2 Maximo");
		}
		return jLabel13;
	}

	private JLabel getJLabel11() {
		if (baseCarrera1 == null) {
			baseCarrera1 = new JLabel();
			baseCarrera1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			baseCarrera1.setBounds(277, 214, 90, 23);
		}
		return baseCarrera1;
	}

	private JLabel getJLabel10() {
		if (jLabel10 == null) {
			jLabel10 = new JLabel();
			jLabel10.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel10.setBounds(443, 161, 100, 23);
			jLabel10.setText("Ciclismo");
		}
		return jLabel10;
	}

	private JLabel getJLabel9() {
		if (jLabel9 == null) {
			jLabel9 = new JLabel();
			jLabel9.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel9.setBounds(277, 161, 100, 23);
			jLabel9.setText("Carrera");
		}
		return jLabel9;
	}

	private JLabel getJLabel8() {
		if (jLabel8 == null) {
			jLabel8 = new JLabel();
			jLabel8.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel8.setBounds(40, 444, 227, 23);
			jLabel8.setText("N2 Umbral Anaerobico");
		}
		return jLabel8;
	}

	private JLabel getJLabel6() {
		if (jLabel6 == null) {
			jLabel6 = new JLabel();
			jLabel6.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel6.setBounds(40, 326, 227, 23);
			jLabel6.setText("N1 Rog de Base");
		}
		return jLabel6;
	}

	private JLabel getJLabel3() {
		if (jLabel3 == null) {
			jLabel3 = new JLabel();
			jLabel3.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel3.setBounds(40, 214, 227, 23);
			jLabel3.setText("Base Lipolisis");
		}
		return jLabel3;
	}

	private JLabel getJLabel2() {
		if (frecMax == null) {
			frecMax = new JLabel();
			frecMax.setFont(new Font("Tahoma", Font.PLAIN, 21));
			frecMax.setBounds(494, 52, 96, 23);
		}
		return frecMax;
	}

	private JLabel getJLabel1() {
		if (jLabel1 == null) {
			jLabel1 = new JLabel();
			jLabel1.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel1.setBounds(237, 52, 245, 23);
			jLabel1.setText("Frecuencia Teorica Máx:");
		}
		return jLabel1;
	}

	private JTextField getJTextField0() {
		if (edadText == null) {
			edadText = new JTextField();
			edadText.setFont(new Font("Tahoma", Font.PLAIN, 21));
			edadText.setBounds(105, 50, 54, 26);
		}
		return edadText;
	}

	private JLabel getJLabel0() {
		if (jLabel0 == null) {
			jLabel0 = new JLabel();
			jLabel0.setFont(new Font("Tahoma", Font.PLAIN, 21));
			jLabel0.setBounds(40, 50, 66, 26);
			jLabel0.setText("Edad:");
		}
		return jLabel0;
	}

	
	public void setActionListeners(final FrecuenciaController frecuenciaController)
	{
		edadText.setActionCommand(Comandos.CALCULAR_FRECUENCIA.toString());
		edadText.addActionListener(frecuenciaController);
		
		btnCap.setActionCommand(Comandos.CAPTURA.toString());
		btnCap.addActionListener(frecuenciaController);
	}
	
	
	public String getEdad()
	{
		return edadText.getText();
	}

	public void setFrecMax(String maxima)
	{
		frecMax.setText(maxima);
	}
	
	public void setCarrera(String baseCar1, String baseCar2, String n1car1, String n1car2, String n2car1, String n2car2,
							String n3car1, String n3car2, String n4car1, String n4car2)
	{
		baseCarrera1.setText(baseCar1);
		baseCarrera2.setText(baseCar2);
		n1carrera1.setText(n1car1);
		n1carrera2.setText(n1car2);
		n2carrera1.setText(n2car1);
		n2carrera2.setText(n2car2);
		n3carrera1.setText(n3car1);
		n3carrera2.setText(n3car2);
		n4carrera1.setText(n4car1);
		n4carrera2.setText(n4car2);
	}
	
	public void setCiclismo(String baseCic1, String baseCic2, String n1cic1, String n1cic2, String n2cic1, String n2cic2,
			String n3cic1, String n3cic2, String n4cic1, String n4cic2)
	{
		baseCiclismo1.setText(baseCic1);
		baseCiclismo2.setText(baseCic2);
		n1ciclismo1.setText(n1cic1);
		n1ciclismo2.setText(n1cic2);
		n2ciclismo1.setText(n2cic1);
		n2ciclismo2.setText(n2cic2);
		n3ciclismo1.setText(n3cic1);
		n3ciclismo2.setText(n3cic2);
		n4ciclismo1.setText(n4cic1);
		n4ciclismo2.setText(n4cic2);
		
	}

	private JButton getBtnCap() {
		if (btnCap == null) {
			btnCap = new JButton("CAP");
			btnCap.setFont(new Font("Tahoma", Font.PLAIN, 16));
			btnCap.setBounds(522, 11, 78, 23);
		}
		return btnCap;
	}
} 
